﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ForzaGT3.Data
{
    public partial class Team
    {
        public void Insert()
        {
            DataRepositoryFactory.CurrentRepository
                .Create<Team>(this);
        }

        public void Update()
        {
            DataRepositoryFactory.CurrentRepository
                .Modify<Team>(this);
        }

        public void Delete()
        {
            DataRepositoryFactory.CurrentRepository
                .Delete<Team>(this);
        }

        public static Team GetById(Guid Id)
        {
            return DataRepositoryFactory.CurrentRepository
                .Single<Team>(x => x.TeamId == Id);
        }

        public static IEnumerable<Team> GetAll()
        {
            return DataRepositoryFactory.CurrentRepository
                .Find<Team>(x => x.IsDeleted == false);
        }
    }
}
